package com.linwen.javase.desgin_pattern.BigTalkDesignPattenJAVACode._02策略模式._4商品价格简单工厂模式;

/**
 * @ClassName CashFactory
 * @Description TODO
 * @Author zero
 * @DATE 2023/7/9 11:42 PM
 * @Version 1.0
 */
public class CashFactory {

    public static CashSuper createCashAccept(int discount) {
        CashSuper cashSuper = null;
        switch (discount){
            case 1:
                cashSuper = new CashNormal();
                break;
            case 2:
                cashSuper = new CashRebate(0.8d);
                break;
            case 3:
                cashSuper = new CashRebate(0.7d);  //打七折
                break;
            case 4:
                cashSuper = new CashReturn(300d,100d);//满300返100
                break;

        }
        return cashSuper;
    }
}
